package com.kili.recommend.data.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

/**
 * @author fenny
 * @since 2019/09/02
 */
@Configuration
public class FileAppendThreadPoolConfig {

    /**
     * 自定义异步线程池
     *
     * @return r
     */
    @Bean(destroyMethod = "shutdown")
    public ExecutorService fileAppend() {
        return new ThreadPoolExecutor(100, 100, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(), Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
    }

}
